/* rssih01.p  Supplier Schedule Release Order API test harness            */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                    */
/* All rights reserved worldwide.  This is an unpublished work.           */
/*-------------------------------------------------------------------------
    File        : rssih01.p

    Description : Test harness program for the Purchase Order API.
                  It uses the include file mfaiih.i to obtain the common
                  API test logic.  The only API-specific code required is
                  an internal procedure for each API method that obtains
                  the data from either the screen or a text file, calls
                  the method, and displays the returned status and
                  messages.

    Notes       : No standard MFG/PRO include files such as mfdeclre.i,
                  mfdtitle.i, mfmsg.i or gprun.i are used in this code,
                  in order to ensure that every API is callable from
                  outside a normal MFG/PRO login session.

    History     :

  ------------------------------------------------------------------------*/
/*  REVISION: 9.0  LAST MODIFIED: 30 AUG 2001   BY: *M1NN* Deirdre O'Brien*/

/*===============================  Tokens  ===============================*/
/*V8:ConvertMode=NoConvert                                                */
/*V8:RunMode=Character,Windows                                            */
/*========================================================================*/

         /*
         * API TEMP-TABLE DEFINITIONS
         */
         {rssit01.i}
         {mfctit01.i}
         {mfconf01.i}
         {scxit01.i}


         /*
         * COMMON API TEST HARNESS DEFINITIONS AND CODE
         */
         {mfaiih.i
            &API-PROGRAM = rssai01
            &API-NAME = "ScheduleRelease"
            &API-METHODS = "              maintainSupplierSchedule              "
            }



/*========================================================================*/
         PROCEDURE runMaintainSupplierSchedule:
/*--------------------------------------------------------------------------
   Purpose      : Obtain input temp-tables for and call the
                  receivePurchaseOrder method, then display the results.
   Parameters   : None.
   Exceptions   :
   Notes        :
   History      :
  ------------------------------------------------------------------------*/

         /*
         * CLEAR DATA FROM PREVIOUS CALL
         */

         for each ttScheduleOrder exclusive-lock:
            delete ttScheduleOrder.
         end.

         for each ttScheduleOrderCmt exclusive-lock:
            delete ttScheduleOrderCmt.
         end.

         for each ttScheduleDet exclusive-lock:
            delete ttScheduleDet.
         end.

         for each ttScheduleCrossRef exclusive-lock:
            delete ttScheduleCrossRef.
         end.




         /*
         * OBTAIN INPUT TEMP-TABLE VALUES IN ORDER, TRAVERSING THE
         * TREE OF TEMP-TABLE PARENT-CHILD RELATIONSHIPS
         *
         * NOTE: THE FIRST PARAMETER OF EACH mfaittin.i REFERENCE
         * BELOW IS ALSO THE NAME OF THE FRAME USED TO DISPLAY THE
         * CORRESPONDING TEMP-TABLE.
         */
         {mfaittin.i &TABLE = "ScheduleOrder" &BEGIN-CHILDREN = ""}
            {mfaittin.i &TABLE = "ScheduleOrderCmt"}
            {mfaittin.i &TABLE = "ScheduleCrossRef"}
            {mfaittin.i &TABLE = "ScheduleDet"}
         {mfaittin.i &TABLE = "ScheduleOrder" &END-CHILDREN = ""}


         /*
         * ERASE TEMP-TABLE FRAMES FROM SCREEN
         */
         if not session:batch-mode then do:
            hide frame ScheduleOrder.
            hide frame ScheduleOrderCmt.
            hide frame ScheduleDet.
            hide frame ScheduleCrossRef.
         end.

         /*
         * CALL API METHOD
         */
         do on error undo, return error return-value:
            run maintainSupplierSchedule in apiProgram (
               input-output table ttScheduleOrder,
               input-output table ttScheduleOrderCmt,
               input-output table ttScheduleDet,
               input-output table ttScheduleCrossRef,
               input scopeTrans,
               input logTrans,
               input transId,
               output table temp_err_msg,
               output success).
         end.


         /*
         * DISPLAY RETURNED STATUS AND MESSAGES
         */
         run showApiRequestStatus.

         /*
         * DISPLAY RETURNED DATA BY TEMP-TABLE
         */
         {mfaittou.i ScheduleOrder}
         {mfaittou.i ScheduleOrderCmt}
         {mfaittou.i ScheduleDet}
         {mfaittou.i ScheduleCrossRef}


         END PROCEDURE. /* run maintain SchOrder */
